﻿@using MyFileView.Shard.Model;
@model  PreviewFileResponseModel

@{

    Layout = null;
    if (Model is null)
    {
        <h1>当前无数据</h1>
        return;
    }
    var url = Request.UrlReferrer +Model.Url.FirstOrDefault();
}


<head>

    <!-- use version 0.20.3 -->
    @*
        <link rel='stylesheet' href='https://gcore.jsdelivr.net/npm/luckysheet@latest/dist/plugins/css/pluginsCss.css' />
        <link rel='stylesheet' href='https://gcore.jsdelivr.net/npm/luckysheet@latest/dist/plugins/plugins.css' />
        <link rel='stylesheet' href='https://gcore.jsdelivr.net/npm/luckysheet@latest/dist/assets/iconfont/iconfont.css' />*@
    <link rel='stylesheet' href='https://gcore.jsdelivr.net/npm/luckysheet@latest/dist/css/luckysheet.css' />
    <script src="https://gcore.jsdelivr.net/npm/luckysheet@latest/dist/plugins/js/plugin.js"></script>
    <script src="https://gcore.jsdelivr.net/npm/luckysheet@latest/dist/luckysheet.umd.js"></script>
    <script src="https://gcore.jsdelivr.net/npm/luckyexcel/dist/luckyexcel.umd.js"></script>
</head>

<h1>excel 预览</h1>
<style>
    /* 根据需要设置单元格样式 */
    .online-table {
        width: 100%;
        height: calc(100% - 4rem);
    }
</style>
<body>
    <div class="online-table" id="domId"></div>

    <script>

        /**/
        window.LuckyExcel.transformExcelToLuckyByUrl('@url', '测试文件', function (exportJson) {
            /**/
            if (exportJson.sheets == null || exportJson.sheets.length == 0) {
                return
            }
            window.luckysheet.create({
                container: 'domId',
                data: exportJson.sheets,
                title: exportJson.info.name,
                userInfo: exportJson.info.name.creator,
                showtoolbar: false, // 是否显示工具栏
                showinfobar: false, // 是否显示顶部信息栏
                allowEdit: false,
                enableAddRow: false, // 允许增加行
                enableAddCol: false, // 允许增加列
                showRowBar: false, // 是否显示行号区域
                showColumnBar: false, // 是否显示列号区域
                sheetFormulaBar: false, // 是否显示公式栏
                enableAddBackTop: false, //返回头部按钮
                rowHeaderWidth: 0, //纵坐标
                columnHeaderHeight: 0, //横坐标
                showstatisticBarConfig: {
                    count: false,
                    view: false,
                    zoom: false,
                },
                hook: {
                    cellMousedown() {
                        return false
                    },
                },
                showsheetbarConfig: {
                    add: false, //新增sheet
                    menu: false, //sheet管理菜单
                    sheet: true, //sheet页显示
                },
                forceCalculation: true, //强制计算公式
            })
        })

    </script>
</body>
